package com.example.campsystem.mapper;

import com.example.campsystem.entity.Camps;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
* @author GJC
* @description 针对表【camps(营地表)】的数据库操作Mapper
* @createDate 2025-04-20 23:23:47
* @Entity com.example.campsystem.entity.Camps
*/
public interface CampsMapper extends BaseMapper<Camps> {

    @Select("SELECT camps.*, b.status as booking_status " +
            "FROM camps " +
            "JOIN bookings b ON camps.id = b.camp_id " +
            "WHERE b.user_id = #{userId}")
    List<Map<String, Object>> selectCampsByUserId(Long userId);
}




